# -*- coding: utf-8 -*-
# @Time : 2021/9/16 20:59
# @Author : Mr  jelis
# @Email : 1402615849@qq.com
# @File : MRSX-ST-CUXIAO.py
# @Project : app_test
"""浓情中秋详情页加入购物车"""

from appium import webdriver
from appium.webdriver.common.mobileby import MobileBy as By
from time import sleep
desired_capabilities={
    "platformName":"Android",
    "deviceName":"127.0.0.1:62001",
    "platformVersion":"7.1.2",
    "appPackage":" cn.missfresh.application",
    "appActivity":"cn.missfresh.module.main.view.MainActivity",
    "noReset":True
}
driver=webdriver.Remote("http://localhost:4723/wd/hub",desired_capabilities)

mid_autumn_locator=(By.XPATH,'//android.widget.ImageView[@resource-id=\"cn.missfresh.application:id/iv_topview\"]')

product_list_first_locator=(By.XPATH,'//android.widget.Image[@text=\"552c6df46615462ba263dff85ec59657\"]')
shopping_locator=(By.XPATH,'//android.view.View[@content-desc="加入购物车"]')

sleep(3)
driver.find_element(*mid_autumn_locator).click()
sleep(3)
driver.find_element(*product_list_first_locator).click()
sleep(3)
driver.find_element(*shopping_locator).click()
sleep(10)
driver.quit()